package com.steven.sync;

/**
 * 可重入锁
 */
public class Syn_ChongRu_test {

    synchronized void m1(){
        for (int i = 0; i < 10; i++) {
            System.out.println(i);
            if(i==2){
                m2();
            }
        }
    }
    synchronized void m2(){
        System.out.println("m2");
    }
    synchronized void m3(){
        System.out.println("m3");
    }

    public static void main(String[] args) {
        Syn_ChongRu_test reentrantLockTest = new Syn_ChongRu_test();
        new Thread(reentrantLockTest::m1).start();
        new Thread(reentrantLockTest::m3).start();
    }


}
